part of '../index.dart';

class MessageEmoji extends StatelessWidget {
  const MessageEmoji({super.key, this.onTap});
  final Function(String emoji)? onTap;

  @override
  Widget build(BuildContext context) {
    return GridView.builder(
      padding: const EdgeInsets.all(0),
      gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
        crossAxisCount: 7,
        mainAxisSpacing: 0,
        crossAxisSpacing: 0,
        childAspectRatio: 1.2,
      ),
      itemCount: Constants.emojiList.length,
      itemBuilder: (context, index) => GestureDetector(
        onTap: () => onTap?.call(Constants.emojiList[index]),
        behavior: HitTestBehavior.opaque,
        child: Text(
          Constants.emojiList[index],
          textAlign: TextAlign.center,
          style: const TextStyle(fontSize: 23),
        ),
      ),
    );
  }
}
